<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">&quot;use strict&quot;;
Object.defineProperty(exports, &quot;__esModule&quot;, { value: true });
exports.MentionMatch = void 0;
var tslib_1 = require(&quot;tslib&quot;);
var abstract_match_1 = require(&quot;./abstract-match&quot;);
<span id='Autolinker-match-Mention'>/**
</span> * @class Autolinker.match.Mention
 * @extends Autolinker.match.AbstractMatch
 *
 * Represents a Mention match found in an input string which should be Autolinked.
 *
 * See this class&#39;s superclass ({@link Autolinker.match.Match}) for more details.
 */
var MentionMatch =  (function (_super) {
    (0, tslib_1.__extends)(MentionMatch, _super);
<span id='Autolinker-match-Mention-method-constructor'>    /**
</span>     * @method constructor
     * @param {Object} cfg The configuration properties for the Match
     *   instance, specified in an Object (map).
     */
    function MentionMatch(cfg) {
        var _this = _super.call(this, cfg) || this;
<span id='Autolinker-match-Mention-property-type'>        /**
</span>         * @public
         * @property {&#39;mention&#39;} type
         *
         * A string name for the type of match that this class represents. Can be
         * used in a TypeScript discriminating union to type-narrow from the
         * `Match` type.
         */
        _this.type = &#39;mention&#39;;
<span id='Autolinker-match-Mention-cfg-serviceName'>        /**
</span>         * @cfg {String} serviceName
         *
         * The service to point mention matches to. See {@link Autolinker#mention}
         * for available values.
         */
        _this.serviceName = &#39;twitter&#39;; // default value just to get the above doc comment in the ES5 output and documentation generator
<span id='Autolinker-match-Mention-cfg-mention'>        /**
</span>         * @cfg {String} mention (required)
         *
         * The Mention that was matched, without the &#39;@&#39; character.
         */
        _this.mention = &#39;&#39;; // default value just to get the above doc comment in the ES5 output and documentation generator
        _this.mention = cfg.mention;
        _this.serviceName = cfg.serviceName;
        return _this;
    }
<span id='Autolinker-match-Mention-method-getType'>    /**
</span>     * Returns a string name for the type of match that this class represents.
     * For the case of MentionMatch, returns &#39;mention&#39;.
     *
     * @return {String}
     */
    MentionMatch.prototype.getType = function () {
        return &#39;mention&#39;;
    };
<span id='Autolinker-match-Mention-method-getMention'>    /**
</span>     * Returns the mention, without the &#39;@&#39; character.
     *
     * @return {String}
     */
    MentionMatch.prototype.getMention = function () {
        return this.mention;
    };
<span id='Autolinker-match-Mention-method-getServiceName'>    /**
</span>     * Returns the configured {@link #serviceName} to point the mention to.
     * Ex: &#39;instagram&#39;, &#39;twitter&#39;, &#39;soundcloud&#39;.
     *
     * @return {String}
     */
    MentionMatch.prototype.getServiceName = function () {
        return this.serviceName;
    };
<span id='Autolinker-match-Mention-method-getAnchorHref'>    /**
</span>     * Returns the anchor href that should be generated for the match.
     *
     * @return {String}
     */
    MentionMatch.prototype.getAnchorHref = function () {
        switch (this.serviceName) {
            case &#39;twitter&#39;:
                return &#39;https://twitter.com/&#39; + this.mention;
            case &#39;instagram&#39;:
                return &#39;https://instagram.com/&#39; + this.mention;
            case &#39;soundcloud&#39;:
                return &#39;https://soundcloud.com/&#39; + this.mention;
            case &#39;tiktok&#39;:
                return &#39;https://www.tiktok.com/@&#39; + this.mention;
            default:
                // Shouldn&#39;t happen because Autolinker&#39;s constructor should block any invalid values, but just in case.
                throw new Error(&#39;Unknown service name to point mention to: &#39; + this.serviceName);
        }
    };
<span id='Autolinker-match-Mention-method-getAnchorText'>    /**
</span>     * Returns the anchor text that should be generated for the match.
     *
     * @return {String}
     */
    MentionMatch.prototype.getAnchorText = function () {
        return &#39;@&#39; + this.mention;
    };
<span id='Autolinker-match-Mention-method-getCssClassSuffixes'>    /**
</span>     * Returns the CSS class suffixes that should be used on a tag built with
     * the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
     * details.
     *
     * @return {String[]}
     */
    MentionMatch.prototype.getCssClassSuffixes = function () {
        var cssClassSuffixes = _super.prototype.getCssClassSuffixes.call(this), serviceName = this.getServiceName();
        if (serviceName) {
            cssClassSuffixes.push(serviceName);
        }
        return cssClassSuffixes;
    };
    return MentionMatch;
}(abstract_match_1.AbstractMatch));
exports.MentionMatch = MentionMatch;
//# sourceMappingURL=mention-match.js.map</pre>
</body>
</html>
